#!/usr/bin/ruby

path = ARGV[0] or raise "Usage: #{$0} output_directory"

def create_batch_file (file_name, command)
	#Open file for writing.
	File.open("#{file_name}.bat", "w") do |file|
		#Add command to turn echo off.
		file.puts "@echo off\n"
		#Add main command.
		file.puts "#{command}\n"
	end
end

#Temporarily change to given path.
Dir.chdir(path) do |path|
	while line = DATA.gets
		line.chomp!
		#Get batch file name and content.
		batch_file_name, command = line.split(/\t/, 2)
		#Create batch file.
		create_batch_file(batch_file_name, command)
	end
end

__END__
play	itch --play
pause	itch --pause
next_track	itch --next-track
previous_track	itch --previous-track
volume_down	itch --volume-down 20
volume_up	itch --volume-up 20
1_star	itch --current-track --set-rating 1
2_stars	itch --current-track --set-rating 2
3_stars	itch --current-track --set-rating 3
4_stars	itch --current-track --set-rating 4
5_stars	itch --current-track --set-rating 5
party_shuffle	itch --playlist "Party Shuffle" --all-tracks --play-found
play_rock	itch --find "rock" --play-found
